{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将\"C:\\Users\\code\\Downloads\\铁通2401\\铁通2401\"中所有文件夹的文件提取，然后在桌面新建文件夹并命名为成绩文件汇总，将提取出的文件放到成绩文件汇总中"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import shutil\n",
    "\n",
    "source_dir = r\"C:\\Users\\code\\Downloads\\铁通2401\\铁通2401\"\n",
    "target_dir = r\"C:\\Users\\code\\Desktop\\成绩文件汇总\"\n",
    "\n",
    "# 如果目标文件夹不存在，则创建它\n",
    "if not os.path.exists(target_dir):\n",
    "    os.makedirs(target_dir)\n",
    "\n",
    "for root, dirs, files in os.walk(source_dir):\n",
    "    for file in files:\n",
    "        file_path = os.path.join(root, file)\n",
    "        shutil.copy(file_path, target_dir)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
